inline
data_conv::data_conv()
{
}


inline
mat
data_conv::openCVtoArma(cv::Mat opencvMat)
{
  int rows = opencvMat.rows;
  int cols = opencvMat.cols;
  cv::Mat matT(opencvMat.t());
  
  fmat armaConv(matT.ptr<float>(),rows, cols);
  
  mat armaMat = conv_to< mat >::from( armaConv );
  
  //cout << opencvMat << endl << endl;
  
  //cout << setprecision(2) << fixed << armaMat << endl;
  
 
  return armaMat;
}



inline
cv::Mat
data_conv::ArmatoOpenCV(mat armaMat)
{
  //armaMat.print("armaMat");

  int rows = armaMat.n_rows;
  int cols = armaMat.n_cols;
  
  fmat armaMat_f = conv_to< fmat >::from( armaMat );
  
  
  cv::Mat opencvMatTmp(cols, rows, CV_32FC1, armaMat_f.memptr());
  cv::Mat opencvMat(opencvMatTmp.t());
 //std::cout << "opencvMat: " << std::endl << opencvMat << std::endl;
 
  return opencvMat;
}



inline
cv::Mat
data_conv::ArmatoOpenCV(vec armaMat)
{
  //armaMat.print("armaMat");

  int rows = armaMat.n_rows;
  int cols = 1;
  
  fmat armaMat_f = conv_to< fmat >::from( armaMat );
  
  
  cv::Mat opencvMatTmp(cols, rows, CV_32FC1, armaMat_f.memptr());
  cv::Mat opencvMat(opencvMatTmp.t());
 //std::cout << "opencvMat: " << std::endl << opencvMat << std::endl;
 
  return opencvMat;
}


inline
vec
data_conv::openCVtoVecArma(cv::Mat opencvMat)
{
  int rows = opencvMat.rows;
  int cols = 1;
  
  cv::Mat matT(opencvMat.t());
  
  fvec armaConv(matT.ptr<float>(),rows, cols);
  
  vec armaMat = conv_to< vec >::from( armaConv );
  
  //cout << opencvMat << endl << endl;
  
  //cout << setprecision(2) << fixed << armaMat << endl;
  
 
  return armaMat;
}
